﻿using System;
using System.Collections.Generic;
using System.Transactions;
using Bingosoft.Data;
using HHMMS.Core.Model;

namespace HHMMS.Core.Service
{
	/// <summary>
	///表示对表SYS_Parameters的所有操作的实现。
	/// </summary>
    public class SYS_ParametersService
    {
		private readonly Dao dao = Dao.Get();
		
		private SYS_ParametersService()
		{}
		
		private static SYS_ParametersService instance = null;
		/// <summary>
		/// SYS_Parameters服务类的单例。
		/// </summary>
        public static SYS_ParametersService Instance
        {
            get
            {
                if (instance == null)
                {
                    lock (typeof(SYS_ParametersService))
                    {
                        instance = new SYS_ParametersService();
                    }
                }
                return instance;
            }
        }
		
		public void Delete(string paramCode)
		{
			Dictionary<string, object> param = new Dictionary<string, object>(){{"ParamCode", paramCode}};
			this.dao.ExecuteNonQuery("psims.sys_parameters.delete", param);
		}
		
		public void Insert(SYS_Parameters sYS_Parameters)
		{
            this.dao.ExecuteNonQuery("psims.sys_parameters.insert", sYS_Parameters);
		}

		public void Update(SYS_Parameters sYS_Parameters)
		{
            this.dao.ExecuteNonQuery("psims.sys_parameters.update", sYS_Parameters);
		}
		
		public SYS_Parameters Single(string paramCode)
		{
			Dictionary<string, object> param = new Dictionary<string, object>(){{"ParamCode", paramCode}};
			return this.dao.QueryEntity<SYS_Parameters>("psims.sys_parameters.single", param);
		}

        public void SaveOrUpdate(SYS_Parameters sYS_Parameters)
        {
            this.dao.ExecuteNonQuery("psims.sys_parameters.insertOrUpdate", sYS_Parameters);
        }
    }
}